-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(uiSelectSingleDirective): add an option to avoid backspace model reset #1736
Conversation
… reset Currently, when you select an option and you press the backspace key, it will reset the model. With this option, we could disable this behavior to avoid the model resetting. Closes angular-ui#926 angular-ui#525
I removed my previous fork by mistake. |
@@ -83,6 +83,11 @@ uis.directive('uiSelect', | |||
$select.sortable = sortable !== undefined ? sortable : uiSelectConfig.sortable; | |||
}); | |||
|
|||
scope.$watch('disableBackspaceReset', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you be watching the attribute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry. I fixed it.
eagerly waiting for this to be merged |
# Conflicts: # test/select.spec.js
we need this compononen.. please merge it ASAP thanks |
# Conflicts: # src/common.js # test/select.spec.js
Any news about my PR? I just sync the fork. Thanks for your answer! 😃 |
@pierregaste Instead of calling it If you do this and update tests etc. I promise we will merge! You appear to have unrelated changes in your commits can you resolve this. Also would help if you squash to single commit for us. Thanks for your patience! |
@pierregaste I just added one more comment too, thanks! |
@@ -83,6 +83,10 @@ uis.directive('uiSelect', | |||
$select.sortable = sortable !== undefined ? sortable : uiSelectConfig.sortable; | |||
}); | |||
|
|||
scope.$watch(function () { return scope.$eval(attrs.backspaceReset); }, function(newVal) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use attrs.$observe(...)
here instead? Only $eval
when value is different. (See resetSearchInput
a few lines down)
@user378230 I replace the |
Add a new option that prevent the backspace key reset the model (set to undefined).
Th option could be added to the directive
ui-select
:I hope I correctly commit and implement this feature! 😃
feat(uiSelectSingleDirective): add an option to avoid backspace model reset
Currently, when you select an option and you press the backspace key, it will reset the model.
With this option, we could disable this behavior to avoid the model resetting.
Closes #926 #525
This line could be added to the wiki page (uiSelect):